package day05;

public class MethodDemo1 {
    //方法参数演示
    public static void main(String[] args) {
        /*
        say();
        say("小王",18); //有参，括号内必须传匹配的参数值
        say("吊毛",60);

        System.out.println("===============================");
        System.out.println(add(10,20));

         */

    }
    //无参返回值
    public static void say(){
        System.out.println("大家好，我是奥利给！");
    }
    //有参无返回值
    public static void say(String name, int age){
        if(age >18){
            return;
        }
        System.out.println("大家好，我是"+name+"今年"+age+"岁了！");
    }
    //有参有返回值
    public static int add(int a,int b){
        return a+b;
    }

    public static void say(int age){}
    public static void say(String name){}
    //public static int say(){return 1;} //编译错误，重载与返回值类型无关
    //public static int say(int add){} //编译错误，重载与方法名无关
}
